<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>组件间通信</title>
</head>

<body>
    <div id="app">
        <one-component :age1="oneAge"></one-component>
        <two-component :age2="twoAge"></two-component>
    </div>
</body>
<script src="../day06/lib/vue.js"></script>
<script>
    let oneComponent = {
        data() {
            return {
                name: '张三'
            }
        },
        props: {
            age1: {
                default: '100',
                type: Number
            }
        },
        template:
        `
        <div>
            <div>我叫{{name}}，我是one-component ,my age is {{age1}}</div>
        </div>
        `

    }
    let twoComponent = {
        data() {
            return {
                name: '李四'
            }
        },
        template:
        `
        <div>
            <div>我叫{{name}}，我是one-compontn ,my age is {{age2}}</div>
        </div>
        `,
        props: ['age2']

    }
    new Vue({
        el: '#app',
        data: {
            oneAge: 23,
            twoAge: 10
        },
        components: {
            oneComponent,
            twoComponent
        }
    })
</script>

</html>